1.CSS3透明度渐变(从左到右)
#grad {
background: -webkit-linear-gradient(left,rgba(198,226,255,1),rgba(198,226,255,0.8));
background: -o-linear-gradient(right,rgba(198,226,255,1),rgba(198,226,255,0.8));
background: -moz-linear-gradient(right,rgba(209,238,238,1),rgba(209,238,238,0.8));
background: linear-gradient(to right, rgba(209,238,238,1), rgba(209,238,238,0.8));
2.从上到下的线性渐变:
#grad {
background: -webkit-linear-gradient(red, blue);
background: -o-linear-gradient(red, blue);
background: -moz-linear-gradient(red, blue);
background: linear-gradient(red, blue);
}
3.从左到右的线性渐变:
#grad {
background: -webkit-linear-gradient(left, red , blue);
background: -o-linear-gradient(right, red, blue);
background: -moz-linear-gradient(right, red, blue);
background: linear-gradient(to right, red , blue);
}
4.创建一个带有彩虹颜色和文本的线性渐变:
#grad {
background: -webkit-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);
background: -o-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);
background: -moz-linear-gradient(left,red,orange,yellow,green,blue,indigo,violet);
background: linear-gradient(to right, red,orange,yellow,green,blue,indigo,violet);
}
5.形状为圆形的径向渐变:
#grad {
background: -webkit-radial-gradient(circle, red, yellow, green);
background: -o-radial-gradient(circle, red, yellow, green);
background: -moz-radial-gradient(circle, red, yellow, green);
background: radial-gradient(circle, red, yellow, green);
}